1. Start with pixel clusters from FlowSOM (Gaussian blur sigma=2)
  2. For each point, for each pixel, look at all neighboring pixels with a radius of 2, i.e. 5x5 kernel around the center pixel. Count the number of each cluster type, then divide by total number of pixels in kernel to get the frequency of each pixel cluster in the kernel (total number of pixels is not always 24 because of edges and empty pixels that didn’t get an assignment).
  3. For each point, divide these frequencies by the total frequency of each cluster in the entire image (like getting an enrichment score - how enriched is cluster A in kernels surrounding cluster B compared to cluster A in the entire image?)
  4. Average across all points

Pixel clusters x marker

All points, enrichment of frequency of pixel cluster in neighbors

Plot each point separately